using System.Web.Security;
using RecruitmentAgency.Models.DataTypes;

namespace RecruitmentAgency.Models.DataProviders
{
    /// <summary>
    /// The RecruitmentAgency.Controllers.IAccountDataProvider interface defines the methods and property required forthe registration and login
    /// </summary>
    public interface IAccountDataProvider 
    {

        /// <summary>
        /// This method check if the username typed by the user is unique
        /// </summary>
        /// <param name="userName">The username typed by the user</param>
        /// <returns>Returns true if the username is unique</returns>
        bool UserNameIsUnique(string userName);

        /// <summary>
        /// Validate the user credential for the login
        /// </summary>
        /// <param name="userName">The user username</param>
        /// <param name="password">The user password</param>
        /// <returns>Returns true if the login is succesfull</returns>
        bool ValidateUser(string userName, string password);

        /// <summary>
        /// Adda new Job seeker records to the database
        /// </summary>
        /// <param name="register">An instance of Register containing the Job seeker details</param>
        /// <returns>Returns an instance of the MembershipCreateStatus containing the result of the attempted registration</returns>
        MembershipCreateStatus CreateUser(Register register);

        /// <summary>
        /// Adda new Job Provider records to the database
        /// </summary>
        /// <param name="provider">An instance of Job Provider containing the company details</param>
        /// <returns>A MembershipCreateStatus instance containing the result of the attempted registration</returns>
        MembershipCreateStatus CreateJobProvider(RegisterJobProvider provider);


        /// <summary>
        /// Gets the user salt key from the database according to the user username
        /// </summary>
        /// <param name="username">The user username</param>
        /// <returns>Returns the User salt Key</returns>
        byte[] GetSaltByUsername(string username);

        /// <summary>
        /// Translate the error returned by registration attempt in a message
        /// </summary>
        /// <param name="createStatus">The result of the attempted registration operation</param>
        /// <returns>Returns a message containing the reason for the failed registration</returns>
        string ErrorCodeToString(MembershipCreateStatus createStatus);
    }
}